#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;

int main() {
    string str1, str2;
    cin >> str1 >> str2;

    int size = 0;
    for (int i = 0; i < str1.size(); ++i) {

        for (int j = 0; j < str2.size(); ++j) {
            int tmpi = i;
            int tmpj = j;
            int tmpsize = 0;
            while (tmpi < str1.size() && tmpj < str2.size() && str1[tmpi++] == str2[tmpj++])
            {
                ++tmpsize;
            }

            if (tmpsize > size) size = tmpsize;
        }
    }
    cout << size;
    return 0;
}